1. Field of the Invention
The present invention relates to disk drives. More particularly, the present invention relates to a disk drive employing a stream detection engine to enhance cache management policy.
2. Description of the Prior Art
Disk drives typically employ a cache system for caching data in semiconductor memory in order to minimize the access time of the disk drive. For example, the access time for read commands is reduced significantly if the read data is already cached in the semiconductor memory. This is because the access time of the semiconductor memory is much faster than the disk due to the mechanical latencies in actuating the head and rotating the disk. Similarly, caching write data for write commands reduces the access time from the host perspective since the write command is completed once the write data has been transferred and stored in the semiconductor memory. The host can transmit additional access commands to the disk drive while the disk drive writes the cached data to the disk.
A further reduction in access time is attained through “predictive caching” wherein additional data sectors preceding and/or following a current read command are cached in anticipation that the host will eventually request these data sectors in subsequent read commands. This is particularly true in applications where data is processed in streams (such as video applications) where there is a high probability that a number of consecutive data sectors will be requested by the host through multiple read commands. Since the cache memory is extremely small compared to the capacity of the disk, a significant effort is made to efficiently manage the cache memory to prevent overflow while retaining the data sectors having the highest cache hit probability. A simple cache management policy de-allocates data sectors from cache based on aging, wherein the oldest or least recently used (LRU) data sectors are de-allocated first since they are least likely to be requested by the host.
U.S. patent application Ser. No. 10/150,172 (Pub. No. 2003/0217230) discloses a more sophisticated cache management policy that identifies and “traces” streams accessed by the host. As new host requests are received causing new data sectors to be cached for a particular stream, the LRU data sectors for that stream are de-allocated from the cache rather than indiscriminately de-allocating LRU data sectors from the cache. Although the stream tracer may improve the de-allocation policy of cache management, it provides only a limited amount of information for enhancing the cache policy firmware.
U.S. Pat. No. 6,260,115 discloses a technique for tracing streams that provides additional information which further enhances cache management. For example, each stream data structure includes a count indicating the number of sequential accesses made by the host. If the count exceeds a threshold, indicating the stream is “very sequential”, the read-ahead prediction value (prestage) for the stream is increased so that more data sectors following a current read command are cached, thereby improving the probability of cache hits for very sequential streams. Although tracking the number of sequential accesses in order to adjust the size of the read-ahead prediction value for a particular stream may improve the probability of cache hits, further improvements to cache management are desirable.
There is, therefore, a need to improve cache management in a disk drive when multiple streams are accessed by a host.